#ifndef _STRAWGUI_NAMED_OBJECT_FABRIC_H_
#define _STRAWGUI_NAMED_OBJECT_FABRIC_H_

#define DEFINE_FABRIC(className, code) namespace fabric \
{ \
class className##_c: public sNamedObjectFabric { public: \
	sNamedObject* CreateObject(sGUI& gui, const db::Record& file) const \
	{ return code; } }; \
static const className##_c className = className##_c(); \
};

#define DEFINE_FABRIC_HEADER(className) namespace fabric \
{ \
class className##_c: public sNamedObjectFabric { public: \
	sNamedObject* CreateObject(sGUI& gui, const db::Record& file) const; \
}; \
extern const className ## _c className; }

#define DEFINE_FABRIC_BEGIN(className) namespace fabric \
{ \
class className##_c: public sNamedObjectFabric { public: \
	sNamedObject* CreateObject(sGUI& gui, const db::Record& file) const \
	{ 

#define DEFINE_FABRIC_END(className) } }; \
const className ## _c className = className ## _c(); \
	}; 


#define DEFINE_FABRIC_IMPL_BEGIN(className) namespace fabric \
{ \
sNamedObject* className##_c::CreateObject(sGUI& gui, const db::Record& file) const \
	{ 

#define DEFINE_FABRIC_IMPL_END(className) } \
const className ## _c className = className ## _c();  \
}

namespace db
{
	class Record;
};

namespace sgui
{

class sGUI;
class sNamedObject;
namespace fabric
{
	class sNamedObjectFabric
	{
	public:
		virtual sNamedObject* CreateObject(sGUI& gui, const db::Record& file) const = 0;
	};
};
};

#endif